package spring.dao.support;

import spring.dao.factory.InitializingBean;
import spring.exceptions.BeanInitializationException;

public abstract class DaoSupport implements InitializingBean {

    @Override
    public void afterPropertiesSet() throws Exception {
        this.checkDaoConfig();

        try {
            this.initDao();
        } catch (Exception ex) {
            throw new BeanInitializationException("初始化DAO失败，原因：" + ex.getMessage(), ex);
        }
    }

    protected abstract void checkDaoConfig() throws IllegalArgumentException;

    protected void initDao() throws Exception {
    }
}
